<?php
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/appconf.php');

//$PNG_TEMP_DIR = UPLOAD_PATH.'/mapi/nmplive/test/qrcode/';
//$PNG_WEB_DIR = '/upload/mapi/nmplive/test/qrcode/';

include "Vendor/phpqrcode/qrlib.php";


$data = isset($_GET['q'])? $_GET['q'] : 'nm:test';


/*$ecc = isset($_GET['ecc'])? $_GET['ecc'] : 'H';
$size = isset($_GET['size'])? $_GET['size'] : 11;

$filename = $PNG_TEMP_DIR.'nmp_'.md5($data.'|'.$ecc.'|'.$size).'.png';
if(!file_exists($filename)){
	QRcode::png($data, $filename, $ecc, $size, 2);
	chmod($filename, 0777);
}
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" />';
*/


/*if (array_key_exists('PATH_INFO', $_SERVER) === false){
   header("HTTP/1.0 404 Not Found"); 
   exit; 
}*/


//$data = substr($_SERVER['PATH_INFO'], 1);
header("Content-Type: image/png");

$error_correction = array('L','M','Q','H');
QRcode::png($data, false, $error_correction[2],12,FALSE);
?>  